package com.ruoyi.web.controller.system;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.TicketBusiness;
import com.ruoyi.system.domain.vo.StatisticsDateVo;
import com.ruoyi.system.domain.vo.StatisticsResultVo;
import com.ruoyi.system.service.TicketCommonService;
import org.apache.commons.compress.utils.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.*;

@RestController
@RequestMapping("/ticketCommon")
public class TicketCommonController extends BaseController {

    @Autowired
    private TicketCommonService statisticsService;

    /**
     * 获取当前登录用户下所有商户
     * @return
     */
    @GetMapping("/getAllBusinessByCurrentUser")
    public List<TicketBusiness> getAllBusinessByCurrentUser()
    {
        return statisticsService.getAllBusinessByCurrentUser();
    }

    public TableDataInfo getStatisticsData(){
        List<Object> res = new ArrayList<>();
        return getDataTable(res);
    }

    /**
     * 获取统计指标
     * @param dateVo
     * @return
     */
    @PostMapping("/getStatistics")
    public TableDataInfo getStatistics(@RequestBody StatisticsDateVo dateVo){
        return getDataTable(Collections.singletonList(statisticsService.getStatistics(dateVo)));
    }


}
